| Conditions | 1 |
| Paths | 1 |
| Total Lines | 62 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | |||
| 5 | ], function ($, Chart) { |
||
| 6 | |||
| 7 | var ctx = $('#queriesOverTime'); |
||
| 8 | var queryChart = new Chart(ctx, { |
||
|
|
|||
| 9 | type: 'line', |
||
| 10 | data: { |
||
| 11 | labels: queryLabels, |
||
| 12 | datasets: [ |
||
| 13 | { |
||
| 14 | data: queryData, |
||
| 15 | label: "# of Queries", |
||
| 16 | |||
| 17 | lineTension: 0.1, |
||
| 18 | fill: false, |
||
| 19 | backgroundColor: 'rgba(206, 43, 23, 0.4)', |
||
| 20 | |||
| 21 | borderColor: 'rgba(206, 43, 23, 1)', |
||
| 22 | borderCapStyle: 'round', |
||
| 23 | borderJoinStyle: 'round', |
||
| 24 | |||
| 25 | pointRadius: 2, |
||
| 26 | pointHitRadius: 10, |
||
| 27 | pointBorderColor: 'rgba(206, 43, 23, 1)', |
||
| 28 | pointBackgroundColor: '#fff', |
||
| 29 | pointBorderWidth: 1, |
||
| 30 | |||
| 31 | pointHoverRadius: 7, |
||
| 32 | pointHoverBackgroundColor: 'rgba(206, 43, 23, 1)', |
||
| 33 | pointHoverBorderColor: '#fff', |
||
| 34 | pointHoverBorderWidth: 3 |
||
| 35 | } |
||
| 36 | ] |
||
| 37 | }, |
||
| 38 | options: { |
||
| 39 | animation: { |
||
| 40 | duration: 0 |
||
| 41 | }, |
||
| 42 | legend: { |
||
| 43 | display: false |
||
| 44 | }, |
||
| 45 | tooltips: { |
||
| 46 | cornerRadius: 3 |
||
| 47 | }, |
||
| 48 | scales: { |
||
| 49 | yAxes: [{ |
||
| 50 | ticks: { |
||
| 51 | beginAtZero:true |
||
| 52 | }, |
||
| 53 | gridLines: { |
||
| 54 | drawBorder: false |
||
| 55 | } |
||
| 56 | }], |
||
| 57 | xAxes: [{ |
||
| 58 | gridLines: { |
||
| 59 | display: false |
||
| 60 | } |
||
| 61 | }] |
||
| 62 | } |
||
| 63 | } |
||
| 64 | }); |
||
| 65 | |||
| 66 | }); |
||
| 67 |